original text by Steve Grand

				********* MACRO LANGUAGE SYNTAX *********

GENERAL SYNTAX:
- All commands on one line
- a single SPACE between every operand
- a single comma (no space) between every command
- square brackets round string arguments eg. [filespec]
- All opcodes are LOWER case - despite being documented as upper case!!!!!!!!
- Labels should be lower case, exactly 4 chars long
- Object names should be UpperLower case, exectly 4 chars long


--------------------------------------------------------------------------------------------------
RVALUES

*********** general-purpose variables

VAR0 to VAR9 variables stored in macro (cleared every time macro starts)

OBV0 to OBV2 variables stored in the TARG object (cleared only when the obj is constructed)


*********** pointers to various objects

TARG - retn curr targ object* as integer
eg. for temp storage in a VAR

OWNR - default object (owner of script, or pet if DDE)

FROM - obj who caused event leading to this script
eg. if script is fr ACTIVATE1, obj who activated me

NORN - current pet creature

PNTR - pointer object

ATTN (IT - obj that OWNR creature is attending to (may be NULL)
NOTE: only OWNR's IT can be determined, not TARG's

CARR - object that's carrying OWNR (may be NULL)

EXEC - object who EXECuted the tool who owns this
dde macro. NOTE: only valid for DDE tools who
*know* that they were executed by an object
in the world (eg. blackboard editor)

EDIT - the contents of the EditObject variable
(addr of object being placed/repositioned/deleted; 
EditObject is set by the EDIT macro or by 
shift-clicking an object. Use this rvalue to delete
selected objects, etc.

********** Type conversion operands

TOKN XXXX - convert 4 characters into an int
eg. TOKN 1234 = integer '4321'
used by NEW: CREA when explicit moniker

********* Sytem operands

WINW - max allowed view window width (WORLD coords)
WINH - max allowed view window height (WORLD coords)

POSL/POSR/POST/POSB - retn obj's lrtb coords

WDTH/HGHT - retn obj's width/height

LIML/LIMT/LIMR/LIMB - retn obj's limits

CLAS - family+genus+sp (Classifier)

FMLY - family (in range 0-255)

GNUS - genus (in range 0-255)

SPCS - species (in range 0-255)

MOVS - MovementStatus (FLOATING, MOUSEDRIVEN, etc)

ACTV - Object's Active flag (INACTIVE=0 ACTIVE1 ACTIVE2)

NEID - obj's neural ID# (0=insignificant)

ATTR - obj's attributes (INVISIBLE, CARRYABLE, etc)

******** TARG CompoundObject, Vehicle, Lift and Aircraft operands

XVEC - vehicle's x mvt vector in 1/256ths pixel

YVEC - vehicle's y mvt vector in 1/256ths pixel

BUMP - vehicle's collision data (bitflags)
b0=hit left b1=hit right b2=top b3=bottom

********* TARG Creature operands

DRIV n - state of creature's Drive# n (hunger etc)

DRV! - creature's MOST PRESSING Drive#
retns 0 (pain) if no drives pressing
Can use in statements such as: "DOIF DRIV DRV! GT 128"
to test level of strongest drive

CHEM n - concentration of a chemical in
creature's bloodstream

BABY - moniker of child genome if TARG is pregnant
Useful to modify scripts for pregnant norns

ASLP - return 1 if creature is asleep

********* Environmental operands

WIND - wind speed/dir near TARG obj (-3 to +3)

TEMP - air temperature near TARG obj (-3 to +3)

ROOM roomnumber edge
return world l,t,r,b or Type of given room
where "edge" = 0=l 1=r 2=t 3=b
or "edge" = 4 returns room Type (INDOORS...)		
Returns 0 if no such room

RMS# - number of rooms defined on map
GND# - number of ground level data on map
GRND x - ground level at position x (worldx/16)

TOTL family genus species
returns the number of objects in the
world who fit this description.
Family, Genus and/or Species can be zero
to act as wildcards. Examples:-
setv totl 4 2 0 ;retns # grendels
setv totl 0 0 0 ;retns total # objects

********** truth-value operands (return 1 if something is true)

TOUC objptr1 objptr2 - return 1 if these two objects are in contact, eg.
	DOIF TOUC TARG OWNR EQ 1
means do if ownr and targ are touching




--------------------------------------------------------------------------------------------------
LVALUES

*********** general-purpose variables

VAR0 to VAR9 variables stored in macro (cleared every time macro starts)

OBV0 to OBV2 variables stored in the TARG object (cleared only when the obj is constructed)


******** Object operands
MOVS - MovementStatus (FLOATING, MOUSEDRIVEN, etc)

CLAS - classifier: family+genus+species+0

NEID - obj's neural ID# (0=insignificant)

ATTR - obj's Attributes bits

ACTV - Object's Active flag (INACTIVE=0 ACTIVE1 ACTIVE2)
NOTE: the HandleActivate() functions *assume* success, and therefore
change the activity status of the object automatically (to ACTIVE1 etc).
I only need use this command if I need to *override* the change, for
example, 'one-shot' activations (for example an obj that just makes a
sound when clicked on) should deactivate themselves at the end of the
macro, otherwise further activations will be suppressed, since the object
is now permanently ACTIVE.

********* TARG CompoundObject, Vehicle, Lift and Aircraft operands

XVEC - vehicle's x mvt vector in 1/256ths pixel

YVEC - vehicle's y mvt vector in 1/256ths pixel

********* TARG Creature operands

BABY - set to 0 to abort a pregancy by removing foetal moniker.
Useful during the egg-laying script, to stop the pregnancy once
the egg has been laid

********** system operands

WINW - max allowed view window width (WORLD coords)

WINH - max allowed view window height (WORLD coords)

NORN - set current pet creature (source for camera & tools)



--------------------------------------------------------------------------------------------------
COMMANDS

*********** DDE data-logging commands (store result in a buffer for reading by external apps)

DDE: SCRP family genus species event
fetch a script from the scriptorium and send it
(used by script editor for reading out & editing existing scripts)

DDE: PUTV RValue
Send an integer RValue

DDE: PUTS [literal string]
Send a string - useful for debugging macros, or for returning the results
of macro commands to test the truth of some condition

DDE: WORD index
read a word from targ BLACKBOARD's list. Sends "###|text|", where ### is the
vocabulary slot (WD_xxx) for the idea represented by the bbd picture whose index 
is Index, and 'text' is the word associated with that picture
Used by blackboard editor tools to fetch words for editing
See "WORD" cmd for writing words into object

DDE: CELL lobe cell dentype
Get statistics about this neurone. Used by brain debug/analysis tools.
Stores the following data in buffer:
Output | Threshold | State | number-of-dens-of-that-type |
total Susceptibility | total STW | total LTW | total Strength
The dendrite values are totalled from all dendrites of the given type in that cell -
the magnitude will vary according to the number of dendrites, which is given
in the returned string (so that gauges and graphs can be scaled appropriately,
or mean values calculated).

************* System commands

SYS: QUIT
Saves world & closes Vivarium
THIS MUST BE THE ONLY/LAST COMMAND IN THE MACRO

SYS: ABRT
Abandons changes to world & closes Vivarium
THIS MUST BE THE ONLY/LAST COMMAND IN THE MACRO

SYS: WRLD [filename.viv]
Opens a new document (world) after saving the current one (if any)
THIS MUST BE THE ONLY/LAST COMMAND IN THE MACRO

SYS: CMND id#
issue an ID_XXX command message to the application
This allows macros to activate ANY menu command
Note that command will get executed LATER - fn doesn't wait before returning!
id# is the decimal ID_XXX value - look these up in the resource file & list them for users

SYS: EDIT l t r b
Set CDisplay::EditBox, so that a rectangle is drawn on screen at the given
WORLD coordinates. Use "SYS: EDIT 0 0 0 0" to remove the box when finished.
This macro is used by map editors and suchlike to mark out rooms and floor
levels during map construction


************ camera, window and scrolling control /////

SYS: WPOS x y width height
attempt to position vivarium frame window to this size (in pixels)
Actual size will be limited to maximum view size or size of screen, if neces

SYS: WTOP
Set vivarium's window to be foreground window
(useful in editor tools etc to allow user access to vivarium for selecting objects etc)

SYS: CMRA x y
Disconnect camera from logged-on creature & position it at these
world coordinates (eg. when editing map etc.)

SYS: GRND x y 
set ground level at position x (worldx/16)

************** object creation

NEW: SCEN imagefile numimages imagenumber plane
Create a scenery object
- imagefile is a 4-byte token representing the filename of the image file
- numimages is the TOTAL number of images IN THAT FILE
- imagenumber is the image associated with this object
- plane is the plot plane (0=back, 9000=front)
example:		new: scen SCN1 37 3 9000

NEW: SIMP imagefile numimages imagenumber plane clone
Create a SimpleObject
- imagefile is a 4-byte token representing the filename of the image file
- numimages is the number of images BELONGING TO THIS OBJECT
- imagenumber is the offset of the first image associated with this object
- plane is the plot plane (0=back, 9000=front)
- clone is 0 normally, or 1 to create a cloned image gallery
example:		new: simp TOYS 3 19 7000 0
Default object has these properties:-
		attributes: none
		classifier: SIMPLE, no genus or species
		behaviour:	dumb (no mouse or creature activation)
		events:		no scripts
		animation:	none

NEW: CBTN imagefile numimages imagenumber plane
Create a CallButton object
- imagefile is a 4-byte token representing the filename of the image file
- numimages is the number of images BELONGING TO THIS OBJECT
- imagenumber is the offset of the first image associated with this object
- plane is the plot plane (0=back, 9000=front)
example:		new: cbtn LIFT 2 19 7000

NEW: COMP imagefile numimages imagenumber clone
Create a CompoundObject
- imagefile is a 4-byte token representing the filename of the image file
- numimages is the number of images BELONGING TO THIS OBJECT
- imagenumber is the offset of the first image associated with this object
- clone is 0 normally, or 1 to create a cloned image gallery
example:		new: comp ENGN 3 19 0
Default object has these properties:-
		attributes: none
		classifier: COMPOUND, no genus or species
		ID neurone: 0  (of no significance to creatures)
		parts:		none
		hotspots:	none
		events:		no scripts
MUST use NEW: PART to add one or more parts to object (initially has none)

NEW: PART part relx rely imageoffset plane
Add a part to the current TARG CompoundObject
Call immediately after NEW: COMP (TARG will point to the new object) to add one or
more parts to this object
- part is the part number (0-9 (0=main part))
- relx,rely are the position of the part RELATIVE to part 0 (use 0,0 for part 0)
- imageoffset is the base sprite for this part relative to first sprite for OBJECT
	 (not to first sprite in file)
- plane = plot plane (0-9000)
After this command, PART is left pointing to this part number (for subsequent
part-relative commands)

NEW: VHCL imagefile numimages imagenumber
Create a Vehicle
- imagefile is a 4-byte token representing the filename of the image file
- numimages is the number of images BELONGING TO THIS OBJECT
- imagenumber is the offset of the first image associated with this object
example:		new: vhcl SDAN 3 19 0
For default object properties, see CompoundObject above

NEW: LIFT imagefile numimages imagenumber
Create a Lift
- imagefile is a 4-byte token representing the filename of the image file
- numimages is the number of images BELONGING TO THIS OBJECT
- imagenumber is the offset of the first image associated with this object
example:		new: lift LFT1 9 0
For default object properties, see CompoundObject above

NEW: CREA moniker sex
Create a newborn creature.
MONIKER is the moniker to use to locate the child's genome file (this file
is generated by: a) the Gene Editor, b) a parent creature using CGenome::Conceive()
or C) the NEW: GENE macro, called by the Hatchery to breed a unique egg)
SEX is 1 if the creature is to be male, 2 if it's to be female or
0 if the sex is to be determined randomly. Normally, sex is randomly determined,
but the initial eggs may need to be pre-sexed.
All the other creature parameters are determined by the resultant genome.
NOTE: the moniker must be supplied as an INTEGER, not a string literal, so that, for
example, EGG objects can store the moniker in OBV0 during incubation.
If I need to store a moniker in a macro as a token, then I must use
the TOKN rvalue to convert it to integer.
Examples:
		NEW: CREA OBV0 0			; create creature bred from moniker stored in var
		NEW: CREA TOKN EVE1 0		; create from explicitely named genome

NEW: GENE mum dad child
Create a new genome file from mum's and dad's (or just mum's if dad=0)
genomes, and store the new genome's moniker in the LVALUE child.
eg. "new: gene tokn eve_ tokn adam obv0" will create a child of Adam and Eve
and store the child's genome moniker in TARG's OBV0 variable.
Use this to conceive a child outside the womb - for example from the Hatchery.


KILL rvalue
Delete the object whose address is rvalue, eg. "kill edit" removes any object
that's been shift-clicked on (EditObject), "kill targ" deletes the target object.


************* execution-flow commands

STOP	
Stop execution (eg. following error, or before subroutine definitions start)
ENDM
Compulsory cmd at end of macro, placed there by Macro constructor
Macro is terminated and maybe self-destructs
only STOP (never ENDM) commands may be placed in the body of macro. ENDM is string terminator

SUBR label 
Identifies a Subroutine. 'label' is a 4-char unique label name
GSUB takes us to point AFTER SUBR labl, so only reach here through normal code
flow. Therefore, treat SUBR the same as STOP (STOP is therefore not needed before
the start of any subroutines). 

GSUB label
Gosubs to given SUBR label
Often has to scan macro for subroutine start, but always remembers the address of the
last subr visited, so most subrs will execute quickly in loops

RETN
returns from a GSUB

REPS #
repeat the following code # times, up to next REPE (# >= 1)
NOTE: REPS/REPE may be nested, but loops must NOT be jumped out of

REPE
end repeat loop

LOOP
Top of LOOP UNTL or LOOP EVER statement (qv)

UNTL val1 EQ val2
Part of LOOP UNTL statement. Repeat LOOP unless condition is true
Valid conditions are EQ NE GT LT GE LE BT BF
LOOPs may be nested, but MUST NOT be jumped out of

EVER
Part of LOOP EVER statement. Repeat LOOP forever (usually a dumb thing to do,
but OK for eg. some creature's actions, where macro is certain to get replaced
by another when action changes)
LOOPs may be nested, but MUST NOT be jumped out of

ENUM family genus species ... NEXT
Iterate through each object which conforms to the given classification,
setting TARG to point to each valid object in turn.
Family, Genus and/or Species can be zero to act as wildcards.
Example:
		ENUM 4 0 0			; for every creature in world
			KILL TARG		; destroy it
		NEXT				; repeat till done


RNDV var min# max#
Set a variable V0-V9 to random # between min# & max# inclusive
(could use with REPS/REPE for random # repeats)

SETV var value#
Set a variable to a constant/variable value

DOIF val EQ val
do next instructions if condition is true, else skip to after correct
nested ELSE or ENDI
Valid conditions are EQ NE GT LT GE LE BT BF

ELSE
Hit an ELSE during normal processing (ie. previous DOIF was true), so
jump from here to corresponding ENDIF, skipping any nested DOIFs en route

ENDI
Marks end of a DOIF or DOIF/ELSE statement. Just ignore it.

WAIT ticks
wait for n ticks (approx n/10 secs) before continuing with next instruction

ADDV lvalue rvalue			; lvalue = lvalue + rvalue
SUBV lvalue rvalue
MULV lvalue rvalue
DIVV lvalue rvalue
MODV lvalue rvalue
NEGV lvalue					; lvalue = 0 - lvalue
ANDV lvalue rvalue			; lvalue = lvalue AND rvalue
ORRV lvalue rvalue			; lvalue = lvalue OR rvalue

DBUG	RValue
Does nothing in release version, but debug version sends RValue as a
TRACE message that I can view on the debugger. A good use for this is to
trace macro sequence of execution. Another use is to display data values,
and a third is to put a breakpoint here, so that I can trace macro
execution in code.

INST
Make the rest of this macro execute in a single tick, regardless of the state
of the Repeat variable.
Use this instruction at the head of DDE macros that must execute a series of
instructions without being interefered with by FastUpdate() calls, etc.
For example, any macro that creates an object should use this so that the object
has been fully initialised before FastUpdate() gets to look at it (especially true
for CompoundObjects, whose Parts don't get created until several instructions
after the NEW: COMP has occurred)

*************** Application, tool and system commands

SCRP family genus species event
All the rest of this macro is to be installed in the system as a Script,
making it available as a new/replacement script for a given type of
object and a given event. This command should normally be the first in the macro.
DDE programs can thus install new scripts into the world by 'executing' the
required script, heading it with a SCRP command.
Family, genus and species are numbers that identify the type of object - they
relate to the top three bytes of the object's Classifier. NOTE: each of these
parameters is a BYTE value (0-255), rather than the absolute value for that
byte position (eg 0x00000000 - 0x00FF0000), ie. a SimpleObject's Family param
is 2, not 0x02000000.
Event is the number of the event that will invoke this script: 0=deactivate,
1=act1, 2=act2, etc. (see enum SCRIPTDEACTIVATE etc in OBJECT.H for final
details).
The Species param can be zero - this means that this script applies to ALL objects
of this family+genus, if they don't have a script that identifies them exactly.
Likewise, both Genus and Species can be zero, meaning that the script is a default
script for all members of that family.

SCRX family genus species event
remove any script answering to this description from the Scriptorium
(eg. used by ObjEd to delete scripts that are no longer needed)


TOOL [fsp] [menutext] [helptext] glyph#
Issued by a DDE tool app to register itself with the toolbar.

EXEC [fsp.exe] [params]
EXEC [c:\path\fsp.exe] [params]
Execute a tool or other application.
If fsp contains backslashes, it must be a full path, so execute GP program.
If no backslashes, assume it's a tool, so try both hard drive AND CD-ROM
[params] are the command-line params for the program (or use [] if none)

ROOM room# l t r b type
Set up a room on map. room# is the room to set up (may be a new room)
l t r b = room rectangle in world coords
type = 0=INDOORS 1=SURFACE 2=UNDERSEA

******************* Sound fx etc.

Any object can only play one controlled effect at a time, but can trigger any number of 
spot effects.  Spot effects do not change panning or volume once played and cannot be stopped.
These should be used only for short sounds.  Controlled sounds can be stopped at any point 
and alter panning and volume to follow the object's position on screen. If the object goes 
out of range, the sound will stop.  Looped sounds will start again when the object comes 
back in range.  When the world is saved, any looped sounds (on screen or off) will be 
serialized also.  These will start up again when the world is reloaded.

SNDV [filename WITHOUT.WAV suffix]			
Now replaced by SNDE (sound effect) which
doesn't require []
This has been kept for back compatibility		
Play sound if TARG obj is visible on screen
Change volume according to distance from screen

SNDE filename (four letter token)		
Play sound effect if TARG obj is visible on screen
Change volume according to distance from screen
This replaced SNDV and doesn't require []'s

SNDQ filename (four letter token) delay		
Play sound effect after a short delay if TARG obj
is visible on screen
Change volume according to distance from screen

SNDC filename (four letter token)		
Start controlled sound if TARG obj is visible
Change volume according to distance from screen

SNDL filename (four letter token)		
Start controlled loop if TARG obj is visible
Change volume according to distance from screen

STPC 			
Stop any controlled sound currently playing

FADE
Fade out any controlled sound currently playing



****************** Object commands 

TARG RValue
Set Targ object pointer to point at given object (RValue = OWNR, FROM, etc.)
TARG OWNR	- (re)set Targ to point at default object (macro owner, or pet if DDE)
TARG FROM	- set Targ to point at cause of this event (no change if isn't an event macro)
TARG NORN	- set Targ to point at the current Pet

EDIT
Attach TARG obj to mouse (even if it's not carryable) so that user can position it.
Used by Object Editor to allow NEW: objects to be positioned
Do this by setting the EditObject variable in VivDoc.cpp. This causes the TaskSwitcher
to make this object follow the mouse until a mouse button is pressed.

ANIM [123432R]	- objects
ANIM [010203R]	- creatures
Start animation of DEST object/part using these poses
CREATURE: poses refer to entries in the pose table; anims are TWO-digit numbers fr creatures

OVER
Wait until the current DEST object's animation is over, before continuing
CARE: anims ending in 'R' will never stop

POSE n
stop any animation of DEST obj's entity, and set it to POSE# n
(pose, not abs image#. ie. same effect as using ANIM[n])

PRLD [1234]
Pre-load image cache with these poses, to make for smoother animation later

BASE n
Specify the base image number for this object/part. Can be used to allow
anims from large tables of images, by moving base sprite# around table.
Value is an ABSOLUTE index into this object's image gallery. CARE: no error checks!
		
PART part#
Set part# for future actions on CompoundObjects, eg. animations

MVTO x y
move object to abs locn and redraw

MVBY xd yd

BHVR click creature
Set SimpleObject's reactions to clicks by mouse and activation requests
from creatures. See SimpleObject::Behaviour() for list of operand values

TICK #ticks
Set the TARG object's timer to given rate.
TIMER scripts will be executed whenever this timer times out.
Set to 0 to disable TIMER events

SPOT spot# left top right bottom
Set up a CompoundObj hotspot, for users/creatures to click on
(See KNOB for how to assign a hotspot to an activation function)
spot# = hotspot# 0-5, ltrb = coords of hotspot on object RELATIVE to part[0]
Set ltrb to -1 -1 -1 -1 to remove a hotspot

KNOB activationfn# hotspot#
Attach a CompoundObj's activation function (ACT1=0 ACT2=1...) to a given hotspot
(eg. to make hotspot# 0 into a Deactivate button, use KNOB 2 0)
set KNOB activationfn -1 to disable an action button

CABN l t r b
Set the relative coords of TARG VEHICLE, LIFT or AIRCRAFT'S Cab (cabin rectangle)
	
GPAS - get passengers
DPAS - drop passengers
SPAS vehicle creature  - get this particular passenger
Load all nearby creatures into TARG VEHICLE or LIFT, or drop them again.
Normal ACTIVATE# scripts for vehicles should call GPAS and normal DEACTIVATE
scripts for vehicles should call DPAS. Any vehicle's COLLISION script that
effectively deactivates the vehicle on collisions should also call DPAS.
These functions are at the discretion of the designer, in case special behavior is reqd.
SPAS is used to get a single creature into a vehicle; the first param is explicit
because eggs use this command to get a given creature into the incubator at hatch time.


BBD: WORD index ID [text]
Blackboards only.
Install a word/idea into targ Blackboard's list
Used by blackboard editor tools to store edited results, and by Object editor
when constructing blackboards. See "DDE: WORD" cmd for reading words

BBD: SHOW
Blackboards only.
draws the current text string text[Obv[0]] onto part0

BBD: EMIT bubble
Blackboards only.
'speak' the current word so that nearby norns can read it and learn the association
between text and concept.
If bubble=0, text is visual, and gets 'read' by norns
If bubble=1, text is 'spoken' by bbd into a speech bubble

BBD: EDIT
Blackboards only.
Allow user to edit the current word



MESG SHOU message				- "shout" send message to all creatures that can hear OWNR obj
MESG SIGN message				- "signal" see OWNR
MESG TACT message				- "tactile" are in contact with OWNR
MESG WRIT object message			- "write" send message to a specific object
Emit a message. Message numbers are: 0=acti1 1=act2 2=deac 3=hit 4=pickup 5=drop
Object is a pointer to an object (TARG, OWNR, FROM or NORN)

STM# SHOU stimulus#
STM# SIGN stimulus#
STM# TACT stimulus#
STM# WRIT object stimulus#
Emit one of the hard-wired stimuli (STIM_DISAPPOINT, etc.)
Stimulus# is a value from 0 to NUMSTIMULI-1, and refers to one of the built-in
stimuli in the stimulus library. Often this command will be enough, but if a more
specialised stimulus is required, use the STIM command (see below)
Object is a pointer to an object (TARG, OWNR, FROM or NORN)

STIM SHOU list of stimulus items
STIM SIGN list of stimulus items 
STIM TACT list of stimulus items 
STIM WRIT object list of stimulus items 
Emit a specialised stimulus to a given creature or nearby creatures
If one of the built-in stimuli will do, use the STM# command (above), but if
none of these is suitable, specify the exact stimulus data using this cmd.
Object is a pointer to an object (TARG, OWNR, FROM or NORN)
"list of stimulus items" refers to a list of values, as follows:
    Significance;      	// amount to nudge significance neurone by
    Input;             	// sensory lobe neurone# (or 255 if none)
    Intensity;         	// Amount to nudge input neurone by
    Features;          	// bit record of features
	chemical0,amount0,		// 4 chemicals to emit into bloodstream (0==unused)
	chemical1,amount1,		// with amounts to emit (0-255 moles)
	chemical2,amount2,
	chemical3,amount3


**************** Creature commands
All these commands apply to the TARG object, which must be a creature
TAKE CARE to return TARG to pointing at OWNR before using these commands
after changing TARG (eg. to _IT_ (ATTN)

FIRE x y amount
Fire the neurone whose position is XY (used by PET scanner, etc.)
'amount' is the signal strength - 0-255 is a 'safe' signal, >255 is
lethal to the cell and 'kills' it (useful for brain surgery!)
NOTE: KILLING CELLS IS NOT YET IMPLEMENTED

TRIG lobe cell amount
Fire this particular neurone by given amount (0-255) - no lethal amounts allowed!


APPR
Approach IT.
Choose a walking animation according to most pressing drive, then start walking
towards _IT_. Continue with next instruction when you are WITHIN REACH of it
(Note: anim isn't cancelled when within reach - I must do it)
See AIM: instruction.

TOUC
Reach out and touch IT.
Normally preceeded by APPR macro. Continue with next instruction when you have
successfully touched IT (or when you are as close as you are going to get).
If total failure (no IT, or IT gone below floor level) then the present action
schema is suppressed (action has failed) and the macro is terminated.
See AIM: instruction.

AIM: act
Set the target point on the IT object for subsequent APPR and/or TOUC commands
Eg. To activate1 IT, do: "AIM: 1,APPR,TOUC"

SAY# n
Speak word n in a speech bubble, and send that word as a SIGNAL
message to all creatures in earshot

SAYN
Speak your most pressing need

IMPT n
Signify how important this (voluntary) action is (how unlikely it is that
another action will override this one before it has finished).
value is the amount that gets used to nudge the current decision
neurone. This instruction should be used at the start of EVERY creature action
macro, and may be used within a macro if the importance
changes during a later phase. Values should be low numbers - 0-9!

DONE
Creatures only. This voluntary or involuntary action has been completed. 
For voluntary actions: resets the decision neurone to force creature to 
make a new decision, and ensures current importance is zero.
Put this cmd at the end of any TRANSIENT voluntary action (eg. act1 but not walkeast)
and after EVERY involuntary action

LTCY action mindelay maxdelay
Set the Latency for the TARG creature's given Involuntary Action (0-7).
Only relevant to Involuntary Action scripts (Creature's relex actions).
Prevent this action repeating for at least DELAY*4 ticks
(DELAY is in 4/10th sec intervals, as decision-making fn gets called only
every 4 ticks, and is a random number between min and max).
This command may be called at the end of an involuntary action script to
prevent reactivation until the chemical which triggered the action has
subsided. A random latency can be useful for actions such as "languish
due to lack of strength", to make them OCCASIONALLY override willed actions.

ASLP 0/1
Go to sleep (close eyes, become insensible to some stimuli) or wake up.
Instruction doesn't change pose - macro must do this after ASLP instr.
Any change of action will automatically wake creature up again.

DREA max
Start dreaming, ie. start processing any pending instincts, instead of 
receiving sensory data from environment. Normally, this should be done
only during deepest sleep phase, plus during embryology, while the
creature is in limbo before hatching. Once activated, MAX pending
instincts will be processed, then the dream state switches off automatically.
Each instinct takes about 5 secs, during which the creature is insensible.
Set MAX to a suitable value - too low and insincts take too many sleeps to get
processed, too high and creatures remain insensible for too long

CHEM chemical amount
Add this much chemical n to TARG's bloodstream



 